#ifndef controller_h
#define controller_h
#include <stdint.h>
#define INLINE_FUN extern __attribute__((gnu_inline)) inline
/************************************************************************************************* 

	Name: CONTROLLER_H
	Autor: JA&AP
	
	Contains: 
				File containing all the functions related to the controller.
				
				
**************************************************************************************************/



#include "structures.h"
// Maximum value of variables
#define MAX_INT         INT16_MAX
#define MAX_LONG        INT32_MAX
#define MAX_I_TERM      (MAX_LONG / 2)
#define MAX_VEL		255
#define MAX_BIAS	MAX_VEL*2
#define MAX_INTEGRAL_TERM	MAX_VEL*2

int PIController(parametersPI * pi, velocities * vels);
//void PIController2(parametersPI * pi, velocities * vels);
void PI_init(parametersPI * pi);
//INLINE_FUN int16_t bound(int16_t value,int16_t min,int16_t max);
#endif
